Part 3 of replication materials for Michael Tomz and Jessica Weeks, “Race, 
Democracy, and Public Support for War," American Political Science Review
Version: July 22, 2025

Part 3 contains all items necessary to replicate our analysis of RPP study 1 
(Qualtrics survey) and RPP study 2 (Prolific survey).

In addition to this readme-Part3.txt file, Part3 contains:

  TomzWeeks-Race-APSR-Part3.do, a Stata do file that reproduces all the analyses.

  Three folders, entitled RPPstudy1, RPPstudy2, and RPPdocumentation

  The RPPstudy1 folder contains a "data" subfolder with the following files:
     qualtrics_survey.rds, the data file RPP posted at https://doi.org/10.7910/DVN/9JWDKK
     qualtrics_survey.csv, a CSV version of the above file
     qualtrics_raw_data.csv, an additional data file provided by RPP on 8/14/2024
     qualtrics_raw_data_noheaders.csv, the above file with extraneous headers removed
 
 The RPPstudy1 folder contains a "code" subfolder with the following files:
     Test23.do, a Stata do-file that produces output for Tables 3-5 of the paper.
     Test4.do, a Stata do-file that produces output for Table 6 and Supplementary Materials
     rsource.ado, a Stata program written by Roger Newson to run an R file in batch mode
     rsource.sthlp, which explains how to use rsource
     FactorAnalysis.R, an R script run in batch mode by Test4.do

  The RPPstudy1 folder contains an "output" subfolder with the following files:
     test23.txt, a text file containing estimates for Tables 3-5 of the paper
     test4.txt, a text file containing estimates for Table 6 and Supplementary Materials
     Table3.xlsx, Table4.xlsx, Table5.xlsx, and Table6.xlsx (output exported as Excel)
     Supp1.xlsx, Supp2.1.xlsx, Supp3.xlsx, Supp4.xlsx, Supp5.xlsx (output exported as Excel)
     qualtrics_ethno.csv, a temporary output file containing RPP ethnocentrism measures
     qualtrics_factorscores.csv, a temporary output file generated by FactorAnalysis.R

  The RPPstudy2 folder contains a "data" subfolder with the following files:
     prolific_survey.rds, the data file RPP posted at https://doi.org/10.7910/DVN/9JWDKK
     prolific_survey.csv, a CSV version of the above file
   
  The RPPstudy2 folder contains a "code" subfolder with the following file:
     Test34.do, which produces output for parts of Table 5 and Supplement Table 2.2

  The RPPstudy2 contains an "output" subfolder with the following files:
     test34.txt, a text file containing estimates for parts of Table 5 and Supplement 2.2
     Table5.3.xlsx (output exported as Excel)
     Supp2.2.xlsx (output exported as Excel)

  The RPPdocumentation folder contains additional documentation, beyond what RPP posted at
     https://doi.org/10.7910/DVN/9JWDKK. The additional documentation consists of two
     files RPP sent by email to Tomz and Weeks on August 14,2024. The files are:
     democratic_peace_flow.docx, providing additional documentation for RPP study 1
     data_cleaning_script.R, documenting how RPP cleaned and prepared RPP study 1

To run code to reproduce all analyses:

  Download TomzWeeks-Race-APSR-Part3.do and the folders entitled RPPstudy1 and RPPstudy2

  Download and install the required R files. Note: In order to compute factor scores using the 
  same R package RPP used, the Stata code invokes R to run FactorAnalysis.R, which in turn relies 
  on the psych package for R. Thus, before running replication code, the user must install R and 
  modify the line in TomzWeeks-Race-APSR-Part3.do that specifies the path to the R executable. 
  The path to the R executable will vary, depending on the computer and operating system you are 
  using. We used R version 4.4.1 and psych package version 2.4.12. We confirmed that the code 
  runs on both Mac OS Sonoma 14.3.1 and Windows 11 Pro.

  Using Stata Version 19.5 or higher, set your working directory to the location of 
  TomzWeeks-Race-APSR-Part3.do and run the do file to replicate analyses of the two RPP surveys.



